package com.junqi.media.event.listener;


import com.junqi.media.event.HlsStartEvent;
import com.junqi.media.hls.HlsHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * hls关闭切片监听器
 *
 */
@Slf4j
@Component
public class HlsEndListener {

    @Autowired
    HlsHandler hlsHandler;

    @Async
    @EventListener(classes = HlsStartEvent.class)
    public void pushMsg(HlsStartEvent event) {
        String streamCode = event.getStreamCode();
        hlsHandler.endHls(streamCode);
    }

}
